package com.youtellv1.utils;

import com.youtellv1.service.ChildPayService;
import com.youtellv1.service.ChildService;
import com.youtellv1.service.TeachersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/data")
public class DataController {

    @Autowired
    private TeachersService teacherService;

    @Autowired
    private ChildService childService;

    @Autowired
    private ChildPayService childPayService;

    @GetMapping("/stats")
    public Map<String, Object> getStats() {
        Map<String, Object> map = new HashMap<>();
        map.put("tnum", teacherService.teachersCountService());
        map.put("cnum", childService.childCountService());
        map.put("pnum", childPayService.countChildService());
        map.put("total", childPayService.countChildPayService());
        return map;
    }
}

